<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
    <h2>API Docs&Test</h2>
    <button id="send-request">submit</button>
    <p>result: 
        <div id="response-area"></div>
    </p>
    <script>
        document.getElementById('send-request').addEventListener('click', function() {
            fetch('/api/chat', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({
                    key1: 'value1',
                    key2: 'value2'
                })
            })
            .then(response => response.text())
            .then(data => {
                document.getElementById('response-area').textContent = data;
            })
            .catch(error => {
                console.error('Error:', error);
                document.getElementById('response-area').textContent = 'Error occurred!';
            });
        });
    </script>
</body>
</html>
